package com.example.sb.config;

import com.example.sb.dao.UserDao;
import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.mapper.MapperFactoryBean;
import org.mybatis.spring.mapper.MapperScannerConfigurer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Repository;

import java.util.zip.CRC32;

/**
 * @author kedong.lin
 */
//@Configuration
public class MybatisConfig {


   /* @Autowired
    private SqlSessionFactory sqlSessionFactory;
    @Bean
    public MapperFactoryBean<UserDao> initUserMapper() {
        MapperFactoryBean<UserDao> mapperFactoryBean = new MapperFactoryBean<>();
        mapperFactoryBean.setSqlSessionFactory(sqlSessionFactory);
        mapperFactoryBean.setMapperInterface(UserDao.class);
        return mapperFactoryBean;
    }*/
//   @Bean
//   public MapperScannerConfigurer mapperScannerConfigurer(){
//       MapperScannerConfigurer configurer = new MapperScannerConfigurer();
//       configurer.setSqlSessionFactoryBeanName("sqlSessionFactory");
//       configurer.setAnnotationClass(Repository.class);
//       configurer.setBasePackage("com.example.sb.*");
//       return configurer;
//   }
}
